Skip to main content

Crashed Windows

· 2 min read

该作品来源于 Steven Lei,本文章仅用于记录和学习,在线预览:CodePen

HTML

<!-- 弹窗盒子 -->
<div id="primary" class="prompt">

<!-- 标题 -->
<div class="title">Kernel Error</div>

<!-- 内容及其按钮 -->
<div class="message">
Unspecified Error
<button>
<span>OK</span>
</button>
</div>

</div>

样式

@mixin box-outline {
&::before,
&::after {
content: "";
position: absolute;
display: block;
width: inherit;
height: inherit;
border: 2px solid;
border-color: #dfdfdf #000 #000 #dfdfdf;
left: -2px;
top: -2px;
pointer-events: none;
}

&::after {
border: 1px solid #fff;
border-color: #fff #7f7f7f #7f7f7f #fff;
left: -1px;
}
}

:root {
font: 15px monospace;

body {
// 让内容垂直局中
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #0d7073;

.prompt {
position: absolute;
width: 300px;
height: 142px;
background: #bfbfbf;
padding: 1px;

user-select: none;
@include box-outline;
}

.title {
background: #00007f;
color: #fff;
padding: 3px 4px;
cursor: move;
box-sizing: border-box;
width: calc(100% - 2px);
}

.message {
margin-top: 15px;
height: 100px;
text-align: center;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;

button {
position: relative;
font-family: inherit;
width: 120px;
height: 24px;
background: #bfbfbf;
border: 0;
padding: 0;
margin: 0;
font: 14px;
cursor: pointer;

@include box-outline;
}
}
}
}